from django import template
from ..models import Post, Category, Tag

register = template.Library()


# @register.inclusion_tag('blog/inclusions/_recent_posts.html', takes_context=True)
# def show_recent_posts(context, num=5):
#     return {
#         'recent_post_list': Post.objects.all().order_by('-created_time')[:num],
#     }

@register.inclusion_tag('blog/inclusions/_archives.html', takes_context=True)
def show_archives(context):
    return {
        'date_list': Post.objects.dates('created_time', 'month', order='DESC'),
    }